#include<bits/stdc++.h>
using namespace std;


bool judgeleapyear(int m)
{
    if (m % 4 == 0 && m % 100 != 0 || m % 400 == 0)
    {
        return true;
    }
    else
        return false;
}

int judgeunm(int x)
{
    int num[] = { 13,1,2,3,5,4,4,2,2,2 };

    int ans = 0;
    while (x)
    {
        int a = 0; a = x % 10;

        ans += num[a];
        x /= 10;
    }

    return ans;
    
}




int main()
{
    int sum= 0;
    int day[] = { 0, 31,28,31,30,31,30,31,31,30,31,30,31 };
    int num = 0;

    int ans = 0;
    for (int i = 2000; i <= 2024; i++)
    {
        if (judgeleapyear(i))
        {
            day[2] = 29;
        }
        else
        {
            day[2] = 28;
        }
        for (int m = 1; m <= 12; m++)
        {
           
            for (int d = 1; d <=day[m]; d++)
            {
                
                int cnt = 0;cnt= (i * 10000) + (m * 100) + d;

             /*   int n = 0;n = judgeunm(cnt); 
                if (n >= 50)
                {
                    ans++;
                }
                  */
                while (cnt)
                {
                    sum += day[cnt % 10];
                    cnt /= 10;
                    if (sum > 50)
                    {
                        //                        std::cout << sum << '\n';
                        ans++;
                        break;
                    }
                }
                sum = 0;
                if (i == 2024 && m >= 4 && d >= 13)
                {
                    std::cout << ans << '\n';
                    return 0;
                }
            }
        }
    }

    cout << ans;
    return 0;
}